import { useDark } from '@vueuse/core'

export const isDark = useDark({
    selector: 'html',
    attribute: 'class',
    initialValue: 'auto',
    valueDark: 'dark',
    valueLight: '',
})

export const initTheme = () => {
    // 在挂载前设置 html 的 class
    if (isDark.value) {
        document.documentElement.classList.add('dark')
        // document.documentElement.classList.remove('light')
    } else {
        document.documentElement.classList.add('light')
        // document.documentElement.classList.remove('dark')
    }
};